import { http } from "@/utils/http";
import { baseUrlApi } from "@/store/utils";

//----------------------------------------项目发票----------------------------------------//
//获取项目发票列表
export const getSoInvoiceList = (params?: object) => {
  return http.request("get", baseUrlApi("soinvoice/list"), { params });
};

// 删除项目发票
export const delProjectInvoiceData = (data?: object) => {
  return http.request("post", baseUrlApi("soinvoice/delete"), { data });
};

// 提交开票申请
export const submitInvoiceInfo = (data?: object) => {
  return http.request("post", baseUrlApi("soinvoice/savestatus"), { data });
};

// 关联发票列表（废弃）
export const getRelatedInvoiceList = (params?: object) => {
  return http.request("get", baseUrlApi("soinvoice/invoicelist"), { params });
};

// 关联发票列表
export const getFindByTypeList = (data?: object) => {
  return http.request("post", baseUrlApi("soinvoice/findByTypeList"), {
    data
  });
};

// 关联发票（废弃）
export const relatedInvoice = (data?: object) => {
  return http.request("post", baseUrlApi("soinvoice/save/invoicelist"), {
    data
  });
};

// 关联发票（多个）
export const relationInvoice = (data?: object) => {
  return http.request("post", baseUrlApi("soinvoice/relationInvoice"), {
    data
  });
};

// 关联结算单
export const relatedSettlement = (data?: object) => {
  return http.request("post", baseUrlApi("soinvoice/saveproject"), {
    data
  });
};

// 红冲
export const redPushInvoice = (data?: object) => {
  return http.request("post", baseUrlApi("soinvoice/redinvoice"), { data });
};

// 根据结算单获取开票清单信息表
export const getInvoiceListByStlmt = (params?: object) => {
  return http.request("get", baseUrlApi("soinvoice/projectlist"), { params });
};

// 根据项目订单获取开票清单信息表
export const getInvoiceListByOrder = (params?: object) => {
  return http.request(
    "get",
    baseUrlApi("soinvoice/projectreconciliationorderlist"),
    { params }
  );
};

// 获取发票开票银行信息 - 公共
export const getInvoiceBankInfo = (params?: object) => {
  return http.request("get", baseUrlApi("dept/info"), { params });
};

// 新建/编辑 项目发票
export const saveInvoiceInfo = (data?: object) => {
  return http.request("post", baseUrlApi("soinvoice/save"), { data });
};

// 获取项目发票详情
export const getinvoiceDetail = (params?: object) => {
  return http.request("get", baseUrlApi("soinvoice/info"), { params });
};

// 获取发票绑定的结算单列表
export const getInvoiceSettlementList = (params?: object) => {
  return http.request("get", baseUrlApi("soinvoice/source"), {
    params
  });
};

// 获取发票绑定的项目订单列表
export const getInvoiceOrderList = (params?: object) => {
  return http.request("get", baseUrlApi("soinvoice/projectOrderlist"), {
    params
  });
};

// 获取项目发票的开票信息列表
export const getInvoiceInfoList = (params?: object) => {
  return http.request(
    "get",
    baseUrlApi("soinvoice/supplyreconciliationorderlist"),
    {
      params
    }
  );
};

// 获取项目发票的开票信息列表Footer数据 后端TODO
export const getInvoiceInfoListFooter = (params?: object) => {
  return http.request(
    "get",
    baseUrlApi("soinvoice/supplyreconciliationorderlist/count"),
    {
      params
    }
  );
};

// 获取项目发票的核对记录
export const getInvoiceCheckListData = (params?: object) => {
  return http.request("get", baseUrlApi("audit/confirm/history/list"), {
    params
  });
};

// 发票云采确认
export const invoiceConfirm = (data?: object) => {
  return http.request("post", baseUrlApi("soinvoice/ycconfirm"), { data });
};

// 保存开票/重新开票信息
export const saveInvoiceInvoDetail = (data?: object) => {
  return http.request("post", baseUrlApi("soinvoice/makeout"), { data });
};
//----------------------------------------供应商发票----------------------------------------//
//获取供应商发票列表
export const getSupInvoicelist = (params?: object) => {
  return http.request("get", baseUrlApi("invoice/list"), { params });
};

//获取供应商发票信息详情
export const getSupInvoiceDetail = (params?: object) => {
  return http.request("get", baseUrlApi("invoice/info"), { params });
};

// 删除供应商发票
export const delSupInvoiceData = (data?: object) => {
  return http.request("post", baseUrlApi("invoice/delete"), { data });
};

// 提交开票申请
export const submitSupInvoice = (data?: object) => {
  return http.request("post", baseUrlApi("invoice/savestatus"), { data });
};

// 红冲
export const redPushSupInvoice = (data?: object) => {
  return http.request("post", baseUrlApi("invoice/redinvoice"), { data });
};

// 获取供应商结算单对应的供货清单
export const getSupInvoiceListByStlmt = (params?: object) => {
  return http.request("get", baseUrlApi("invoice/projectlist"), {
    params
  });
};

// 获取供货订单对应的供货清单
export const getSupInvoiceListByOrder = (params?: object) => {
  return http.request(
    "get",
    baseUrlApi("invoice/projectreconciliationorderlist"),
    {
      params
    }
  );
};

// 新建/编辑 供应商发票
export const saveSupInvoiceInfo = (data?: object) => {
  return http.request("post", baseUrlApi("invoice/save"), { data });
};

// 获取发票绑定的结算单列表
export const getSupInvoiceSettlementList = (params?: object) => {
  return http.request("get", baseUrlApi("invoice/source"), {
    params
  });
};

// 获取发票绑定的供货订单列表
export const getSupInvoiceOrderList = (params?: object) => {
  return http.request("get", baseUrlApi("invoice/projectOrderlist"), {
    params
  });
};

// 获取供应商发票的开票信息列表
export const getSupInvoiceInfoList = (params?: object) => {
  return http.request(
    "get",
    baseUrlApi("invoice/supplyreconciliationorderlist"),
    {
      params
    }
  );
};

// 获取供应商发票的开票信息列表Footer数据
export const getSupInvoiceInfoListFooter = (params?: object) => {
  return http.request(
    "get",
    baseUrlApi("invoice/supplyreconciliationorderlist/count"),
    {
      params
    }
  );
};

// 获取供应商发票的核对纪录
export const getSupInvoiceCheckListData = (params?: object) => {
  return http.request("get", baseUrlApi("audit/confirm/history/list"), {
    params
  });
};

// 发票云采确认
export const supInvoiceConfirm = (data?: object) => {
  return http.request("post", baseUrlApi("invoice/ycconfirm"), { data });
};

// 保存开票/重新开票信息
export const saveSupInvoiceInvoDetail = (data?: object) => {
  return http.request("post", baseUrlApi("invoice/makeout"), { data });
};
